package com.cumt.threeway.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;

import com.cumt.threeway.R;
import com.cumt.threeway.constant.ThreeWayConstant;
import com.cumt.threeway.util.ThreeWayUtil;

/**
 * Created by 胡晶晶 on 2016/5/25.
 */
public class SettingActivity extends FragmentActivity implements View.OnClickListener{

    private Button mBtnLogout;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.wode_shezhi_layout);
        initView();
    }

    private void initView() {
        findViewById(R.id.btn_back).setOnClickListener(this);
        findViewById(R.id.rl_version_info).setOnClickListener(this);
        findViewById(R.id.rl_about_us).setOnClickListener(this);
        findViewById(R.id.rl_submit_info).setOnClickListener(this);
        mBtnLogout = (Button) findViewById(R.id.btn_logout);
        mBtnLogout.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        if(v == null) {
            return;
        }
        switch (v.getId()) {
            case R.id.btn_back:
                finish();
                break;
            case R.id.rl_version_info:
                goVersionActivity();
                break;
            case R.id.rl_about_us:
                goAboutUsActivity();
                break;
            case R.id.rl_submit_info:
                goSuggestionActivity();
                break;
            case R.id.btn_logout:
                Intent intent = new Intent(this, LoginActivity.class);
                intent.putExtra("key", ThreeWayConstant.REQUEST_CODE_FOR_LOGIN);
                startActivity(intent);
                break;
        }
    }

    private void goSuggestionActivity() {
        Intent intent = new Intent(this, SubmitSuggestionActivity.class);
        startActivity(intent);
    }

    private void goLogoutActivity() {
        Intent intent = new Intent(this, LogoutActivity.class);
        startActivity(intent);
    }

    private void goAboutUsActivity() {
        Intent intent = new Intent(this, AboutUsActivity.class);
        startActivity(intent);
    }

    private void goVersionActivity() {
        Intent intent = new Intent(this, VersionActivity.class);
        startActivity(intent);
    }
}
